<template>
  <abstract-dialog
    :loading="loading"
    append-to-body
    :title="title"
    :value="value"
    width="50%"
    @close="cancel"
    @open="open"
  >
    <abstract-form ref="form" label-width="180px">
      <abstract-form-item :model="form" thin label="组织架构标题">
        <span>{{ data.org.title }}</span>
      </abstract-form-item>
      <abstract-form-item :model="form" thin label="组织架构版本号">
        <span>{{ data.org.version }}</span>
      </abstract-form-item>
      <abstract-form-item :model="form" thin label="考核日期">
        <span>{{ data.t }}</span>
      </abstract-form-item>
      <abstract-form-item :model="form" thin label="所有人的上级打分（次）">
        <span>{{ data.q1 }}</span>
      </abstract-form-item>
      <abstract-form-item :model="form" thin label="科长平级打分（次）">
        <span>{{ data.q2 }}</span>
      </abstract-form-item>
      <abstract-form-item :model="form" thin label="科员平级打分（次）">
        <span>{{ data.q3 }}</span>
      </abstract-form-item>
      <abstract-form-item :model="form" thin label="科员组内互评（次）">
        <span>{{ data.q4 }}</span>
      </abstract-form-item>
      <abstract-form-item :model="form" thin label="科员无需平级打分（人）">
        <span>{{ data.q5 }}</span>
      </abstract-form-item>
      <abstract-form-item :model="form" thin label="总打分（次）">
        <span>{{ data.allQ }}</span>
      </abstract-form-item>
      <!-- <div style="margin-bottom: 0; display: none">
        <abstract-form-item>
          <el-input></el-input>
        </abstract-form-item>
      </div> -->
    </abstract-form>
    <template v-slot:footer>
      <el-button plain size="small" @click="closeDialog">取 消</el-button>
      <el-button size="small" type="primary" @click="confirm">确 定</el-button>
    </template>
  </abstract-dialog>
</template>

<script>
import AbstractDialog from '@/components/abstract/Dialog'
import dialogMixin from '@/mixin/dialogMixin'
import AbstractForm from '@/components/abstract/Form'
import AbstractFormItem from '@/components/abstract/Form/item'
import { elSuccess } from '@/utils/message'
import { request } from '@/api/request'

export default {
  name: 'AddDialog',

  components: {
    AbstractDialog,
    AbstractForm,
    AbstractFormItem
  },

  mixins: [dialogMixin],

  props: {
    value: Boolean,
    data: {
      type: Object,
      default: () => ({
        allQ: null,
        org: {
          version: null,
          title: null
        },
        q1: null,
        q2: null,
        q3: null,
        q4: null,
        q5: null,
        t: null
      })
    }
  },

  data() {
    return {
      users_id: '',
      loading: false,
      title: '创建工作小结通知',
      form: {
        title: ''
      },
      rules: {}
    }
  },

  methods: {
    open() {
      this.isUpdateData = true
    },

    cancel() {
      this.closeDialog()
      //   this.clearForm()
    },

    confirm() {
      if (this.loading) return
      this.loading = true
      const promise = request(
        'company/workSum/workSumNotice/submitCreation',
        {},
        () => {}
      )
      promise
        .then(() => {
          elSuccess()
          this.$emit('success')
          this.cancel()
        })
        .finally(() => this.$nextTick(() => (this.loading = false)))
    }
  }
}
</script>
